﻿using System;
using System.Xml.Serialization;

namespace Limestone.Fields
{
    [Serializable]
    public class ImageField : Field, IField
    {
        [XmlAttribute]
        public string ImageUrl { get; set; }
        public string AlternateText { get; set; }

        public new ImageFieldSetting Settings
        {
            get { return base.Settings as ImageFieldSetting; }
            set { base.Settings = value; }
        }

        public ImageField()
            : base(FieldType.ImageField, "")
        {
            ImageUrl = "";
            AlternateText = "";
        }
        public ImageField(string name)
            : base(FieldType.ImageField, name)
        {
            ImageUrl = "";
            AlternateText = "";
        }


        public string GetHtml()
        {
            return "<img src=\"" + ImageUrl + "\" alt=\"" + AlternateText + "\" />";
        }
    }
}
